//
//  QTHeadView.m
//  QTLifeCircle
//
//  Created by 王琼 on 17/1/16.
//  Copyright © 2017年 徐腾. All rights reserved.
//

#import "QTHeadView.h"
#import "QTHomeHeadViewCell.h"
#import "QTLifeCircleNetworkingTool.h"
#import <YYModel.h>
@interface QTHeadView()<UICollectionViewDataSource,UICollectionViewDelegate>

@property(nonatomic, weak) IBOutlet UICollectionView *collectionView;


@end


@implementation QTHeadView

 //数据传进来如果显示不出来视图,就写set方法
-(void)setModelList:(NSMutableArray *)modelList
{
    _modelList = modelList;
    if(modelList != nil)
    {
        [self.collectionView reloadData];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;

}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.modelList.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    QTHomeHeadViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"headerItem" forIndexPath:indexPath];
    //========== 请求数据
    cell.model = self.modelList[indexPath.item];
    return cell;
}


@end
